Skip to content

feat: doc-blocker を slop パターン拒否方式に反転(#112、v0.62.0)#127

Merged
okash1n merged 1 commit into
mainfrom
issue/112-doc-blocker-invert
Jun 12, 2026
Merged

feat: doc-blocker を slop パターン拒否方式に反転(#112、v0.62.0)#127
okash1n merged 1 commit into
mainfrom
issue/112-doc-blocker-invert

Conversation

@okash1n

@okash1n okash1n commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

概要

LLM 性能監査計画 #121 の P2-06(#112)。doc-blocker を「allowlist 外は全拒否(exit 2)」から「slop パターンのみ確認に降格」へ反転する。

変更内容

  • deny-by-pattern 化: basename が SUMMARY / REPORT / FINDINGS / ANALYSIS / NOTES / RESULTS / TAKEAWAYS 系(大文字小文字不問、アンダースコア結合変形含む)に一致する場合のみ反応。CHANGELOG.md・LICENSE.txt・docs/ 配下・ADR・release-notes.md 等の一般文書は素通し
  • ブロック → 確認に降格: exit 2 を全廃し、PreToolUse の hookSpecificOutput.permissionDecision: ask を出力(公式 hooks 仕様の必須フィールド hookEventName 込み。仕様は code.claude.com/docs/en/hooks で確認済み)。ユーザーが明示依頼した文書なら 1 確認で通せる
  • 確認メッセージ: 対象パス・常時許可パス一覧・無効化手段(ENABLE_DOC_BLOCKER=false)を明記
  • allowlist は常時許可で維持: HANDOVER.md / .reports/ / docs/CODEMAPS/ 等のキット出力先は slop 名(.reports/SUMMARY.md 等)でも許可。評価順序(allowlist → slop 判定)の回帰テストを追加
  • 設計判断: ハイフン接尾辞(REPORT-2026.md / release-notes.md)は対象外 — 正当な命名(release-notes 等)との衝突を避けるため、Issue の推奨正規表現どおりアンダースコア結合のみ対象

検証

  • shellcheck green / unit 344/344(書換後 5 テスト + allowlist-slop 優先順位ケース追加)/ scenarios 44 Pass + 1 Skip
  • 実機: slop 4 種 → ask、一般文書 7 種 → 素通し、非 doc ファイル → 素通し
  • 内部レビュー(code-reviewer agent): high 1 件(hookEventName の要否未検証)→ 公式ドキュメントで必須と確認し現状維持が正、medium 1 件(allowlist-slop 優先順位テスト欠如)→ 追加済み

Closes #112

- allowlist 外全拒否 + exit 2 を撤廃し、SUMMARY/REPORT 系のアドホック文書名のみ permissionDecision: ask に降格
- 一般文書(CHANGELOG.md / LICENSE.txt / docs/** / ADR 等)は素通し
- キット出力先 allowlist は常時許可として維持(slop 名でも許可、評価順序テスト付き)
- 確認メッセージに対象パス・復帰手段を明記

Closes #112
Copilot AI review requested due to automatic review settings June 12, 2026 01:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b23efe0e69

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return "$matched"
}

if [[ "$file_path" =~ \.(md|txt)$ ]] && ! _doc_blocker_allowed_path "$file_path"; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match uppercase doc extensions before allowing slop files

When the Write target is a slop filename with an uppercase extension such as SUMMARY.MD or NOTES.TXT, this outer case-sensitive \.(md|txt)$ guard fails before _doc_blocker_slop_name can run its nocasematch regex, so the hook falls through and allows the write instead of returning the intended permissionDecision: "ask". This leaves a simple filename casing bypass for the new case-insensitive deny-by-pattern behavior.

Useful? React with 👍 / 👎.

@okash1n okash1n merged commit a364d82 into main Jun 12, 2026
12 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the doc-blocker hook by inverting it from a strict allowlist + hard block to a deny-by-pattern guard that only intervenes on “slop” doc filenames (e.g., SUMMARY/REPORT/FINDINGS…), and it downgrades intervention from blocking (exit 2) to an interactive permission ask.

Changes:

  • Update check-doc-write.sh to allow most documentation writes and emit permissionDecision: "ask" only for slop-pattern doc names (while keeping existing always-allowed kit output paths).
  • Update unit tests/fixtures to assert the new “ask” behavior and ensure allowlist precedence over slop detection.
  • Refresh user-facing documentation/strings and add a v0.62.0 changelog entry describing the behavior change.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
features/doc-blocker/scripts/check-doc-write.sh Implements deny-by-pattern detection and emits permissionDecision: ask for slop doc names instead of exiting 2
tests/unit/test-doc-blocker.sh Updates unit coverage for allow/pass/ask behavior and verifies exit-2 hard blocks are removed
tests/unit/test-hook-fixtures.sh Adjusts fixture smoke test to expect permissionDecision: ask output for the doc write fixture
features/doc-blocker/feature.json Updates feature description to reflect ask-only behavior for slop-pattern docs
README.md Updates hook table description for doc-blocker’s new behavior
README.en.md English README update for doc-blocker’s new behavior
i18n/ja/strings.sh Updates Japanese wizard hook description string for doc-blocker
i18n/en/strings.sh Updates English wizard hook description string for doc-blocker
docs/wizard-config-mapping.md Updates config mapping doc for doc-blocker behavior
docs/wizard-config-mapping.en.md English mapping doc update for doc-blocker behavior
CHANGELOG.md Adds v0.62.0 entry documenting the behavioral inversion and ask downgrade

Comment on lines +27 to +36
_doc_blocker_slop_name() {
local base="$1"
local matched=1
shopt -s nocasematch
if [[ "$base" =~ ^(.*_)?(SUMMARY|REPORT|FINDINGS|ANALYSIS|NOTES|RESULTS|TAKEAWAYS)(_.*)?\.(md|txt)$ ]]; then
matched=0
fi
shopt -u nocasematch
return "$matched"
}
return "$matched"
}

if [[ "$file_path" =~ \.(md|txt)$ ]] && ! _doc_blocker_allowed_path "$file_path"; then
@okash1n okash1n deleted the issue/112-doc-blocker-invert branch June 12, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P2-06] doc-blocker を allowlist 全拒否から slop パターン拒否方式へ反転

2 participants